/*
 * Copyright (c) 2025-present, Jhuix (Hui Jin) <jhuix0117@gmail.com>. All rights reserved.
 * Use of this source code is governed by a MIT license that can be found in the LICENSE file.
 */
.hidden {
  display: none !important;
}

.divider {
  display: none;
  width: 2px;
  background: #d2d2d2;
  cursor: col-resize;
  position: relative;
  transition: background 0.3s;
  justify-content: center;
  align-items: center;
}

.divider:hover {
  background: #f59102;
}

.icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  fill: currentColor;
  overflow: hidden;
}

.toc-switch {
  position: fixed;
  z-index: 110;
  top: 0;
  right: 2rem;
  font-size: 3rem;
  color: #3e69d7;
  overflow: hidden;
  cursor: pointer;
  text-align: center;
  box-sizing: border-box;
  -moz-transition: height 0.2s linear;
  -webkit-transition: height 0.2s linear;
  -o-transition: height 0.2s linear;
  transition: height 0.2s linear;
}

.total-toc {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: 100%;
  order: -1;
  page-break-after: always;
  break-after: page;

  .toc-view ul li div i:not(.toc-chapter) {
    cursor: pointer;
  }
}

.showdown-toc {
  .toc-pin {
    display: flex;
    flex-direction: row;
    padding: 1rem;
    align-items: center;
    flex-shrink: 0;
    overflow: hidden;
    font-size: 2rem;
    border-bottom: 1px solid #d2d2d2;
  }

  .toc-pin-text {
    margin-right: 8px;
    font-weight: 700;
    white-space: nowrap;
  }

  .toc-fold-wrap {
    flex-grow: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
  }

  .toc-icon {
    background-position: 50%;
    background-repeat: no-repeat;
    cursor: pointer;
  }

  .toc-close {
    margin-left: auto;
  }

  .toc-icon:hover {
    color: rgb(0, 137, 255);
  }

  .toc-view {
    width: 100%;
    overflow: auto;

    .toc-chapter {
      color: rgb(0, 137, 255);
    }

    ul {
      display: block;
      position: relative;
      margin-left: 2rem;
      padding-left: 0;

      li {
        width: 100%;
        list-style: none;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;

        div {
          display: flex;
          flex-direction: row;

          i {
            margin-left: 0;
            position: relative;
            display: inline-flex;
            align-items: center;
          }

          a {
            color: currentColor;
            font-size: 1.4rem;
            padding: 0.6rem;
            white-space: nowrap;
            text-decoration: none;
            cursor: pointer;
          }
        }

        div:hover {

          i,
          a {
            color: #f59102;
          }

          a {
            border-radius: 0.5rem;
          }
        }

        div:focus {

          i,
          a {
            color: rgb(0, 137, 255);
          }

          a {
            border-radius: 0.5rem;
          }
        }
      }

      ul {
        margin-top: 0.24rem;
      }
    }

    .toc-multi-title {
      font-weight: 600;
    }

    .toc-title-1 {
      font-weight: 800;
      font-size: 1.6rem;
    }
  }
}

.main-toc-row {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid #dfdfdf;
  flex-grow: 1;

  .toc-view {
    flex-grow: 1;
  }
}

.toc-view::-webkit-scrollbar-thumb {
  background-color: #f59102;
}

@media not print {
  .main-toc-row {
    flex-direction: row;
  }

  .main-toc-row .total-toc {
    z-index: 11;
    white-space: nowrap;
    box-sizing: border-box;
    background: #ffffffd2;
    border-radius: 10px;
    width: 25%;
    max-height: 100vh;
    max-width: 50%;
    min-width: 256px;
    min-height: 300px;
    margin-right: 12px;
    transition: all .3s;
    position: fixed;
    top: 0;
    right: 0;
    overflow: hidden;
    box-shadow: 0 5px 11px #3333;
  }

  .main-toc-row .toc-view {
    overflow: auto;
  }
}

@media print {
  .main-toc-row .total-toc {
    max-width: unset !important;
    width: 100% !important;
    overflow: unset !important;
    order: -1 !important;
  }
}

.showdown-toc .toc-view {
  width: 100%;
  display: flex;

  .toc-main {
    margin-left: 1rem;
    flex-grow: 1;
  }
}

.main-toc-column {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-grow: 1;
}
